home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / man / lib.fmt / c / Pfs.man < prev    next >
Encoding:
Text File  |  1990-11-13  |  27.5 KB  |  663 lines

  1.  
  2.  
  3.  
  4. Pfs                   C Library Procedures                    Pfs
  5.  
  6.  
  7.  
  8. _________________________________________________________________
  9.  
  10. NNAAMMEE
  11.      Pfs_Open, Pfs_OpenConnection, Pfs_SetHandler,  Pfs_PassFile,
  12.      Pfs_Close - Package for servicing pseudo-file-systems.
  13.  
  14. SSYYNNOOPPSSIISS
  15.      ##iinncclluuddee <<ppddeevv..hh>>
  16.  
  17.      Pfs_Token
  18.      PPffss__OOppeenn(_p_r_e_f_i_x, _r_o_o_t_I_D_P_t_r, _p_f_s_S_e_r_v_i_c_e, _c_l_i_e_n_t_D_a_t_a)
  19.      Pdev_Stream *
  20.      PPffss__OOppeennCCoonnnneeccttiioonn(_p_f_s_T_o_k_e_n, _f_i_l_e_I_D_P_t_r, _r_e_q_B_u_f_S_i_z_e, _r_e_a_d_B_u_f_-
  21.      _S_i_z_e, _r_e_a_d_B_u_f, _s_e_l_e_c_t_B_i_t_s, _p_d_e_v_S_e_r_v_i_c_e)
  22.      int (*
  23.      PPffss__SSeettHHaannddlleerr(_p_f_s_T_o_k_e_n, _o_p_e_r_a_t_i_o_n, _h_a_n_d_l_e_r))()
  24.      int
  25.      PPffss__PPaassssFFiillee(_p_f_s_T_o_k_e_n, _s_t_r_e_a_m_I_D)
  26.      void
  27.      PPffss__CClloossee(_p_f_s_T_o_k_e_n)
  28.  
  29. AARRGGUUMMEENNTTSS
  30.      char            *_p_r_e_f_i_x       (in)      File name prefix  of
  31.                                              the     pseudo-file-
  32.                                              system.
  33.  
  34.      Fs_FileID       *_r_o_o_t_I_D_P_t_r    (in)      The   server-defined
  35.                                              ID of the root.
  36.  
  37.      Pfs_CallBacks   *_p_f_s_S_e_r_v_i_c_e   (in)      Set of name  service
  38.                                              call-back       pro-
  39.                                              cedures.
  40.  
  41.      ClientData      _c_l_i_e_n_t_D_a_t_a    (in)      User-defined    data
  42.                                              passed   to  service
  43.                                              call-backs.
  44.  
  45.      Pfs_Token       _p_f_s_T_o_k_e_n      (in)      Return   value    of
  46.                                              PPffss__OOppeenn.
  47.  
  48.      Fs_FileID       *_f_i_l_e_I_D_P_t_r    (in)      Server's  identifier
  49.                                              for  file in pseudo-
  50.                                              file-system.
  51.  
  52.      int             _r_e_q_B_u_f_S_i_z_e    (in)      Preferred  size  for
  53.                                              the request buffer.
  54.  
  55.      int             _r_e_a_d_B_u_f_S_i_z_e   (in)      Size of read buffer.
  56.                                              Zero  means  no read
  57.                                              buffering.
  58.  
  59.      char            *_r_e_a_d_B_u_f      (in)      Optional        read
  60.  
  61.  
  62.  
  63. Sprite v.1.0       Printed:  November 12, 1990                  1
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. Pfs                   C Library Procedures                    Pfs
  71.  
  72.  
  73.  
  74.                                              buffer, or NULL.
  75.  
  76.      int             _s_e_l_e_c_t_B_i_t_s    (in)      FFSS__RREEAADDAABBLLEE,
  77.                                              FFSS__WWRRIITTAABBLLEE,
  78.                                              FFSS__EEXXCCEEPPTTIIOONN
  79.  
  80.      Pdev_CallBacks  *_p_d_e_v_S_e_r_v_i_c_e  (in)      Set of pseudo-device
  81.                                              service    call-back
  82.                                              procedures.
  83.  
  84.      int             _s_t_r_e_a_m_I_D      (in)      A regular open  file
  85.                                              descriptor  returned
  86.                                              from ooppeenn.
  87.  
  88. _________________________________________________________________
  89.  
  90. PPffss__OOppeenn
  91.      PPffss__OOppeenn declares a server process for a  pseudo-file-system
  92.      and  installs  a set of service procedures for it.  The ser-
  93.      vice procedures are called when  client  processes  do  file
  94.      naming  operations  on  the  pseudo-file-system,  i.e. ooppeenn,
  95.      ssttaatt, uunnlliinnkk, mmkkddiirr, rrmmddiirr, rreennaammee, and  lliinnkk.   As  a  side
  96.      effect  of  opening  a  file  in  the pseudo-file-system the
  97.      server can set up a pseudo-device connection  for  the  open
  98.      file.   Thus the server can completely implement file system
  99.      access to the pseudo-file-system.
  100.  
  101.      The _p_r_e_f_i_x argument indicates what part of the  global  file
  102.      system  hierarchy  is  controlled  by the pseudo-file-system
  103.      server.  This  prefix  can  be  arbitrarily  nested  in  the
  104.      hierarchy  but  there must be a remote link that corresponds
  105.      to it.  (The command llnn --rr _p_r_e_f_i_x creates a remote link  for
  106.      the  prefix.)  The existence of the remote link ensures that
  107.      the kernel's lookup algorithm will  automatically  find  the
  108.      pseudo-file-system  server.  The pseudo-file-system is visi-
  109.      ble across the network as well.
  110.  
  111.      The _r_o_o_t_I_D_P_t_r defines the  file  ID  for  the  root  of  the
  112.      pseudo-file-system.   This  ID will be presented as the pprree--
  113.      ffiixxIIDD for pathnames that begin at the root (prefix)  of  the
  114.      pseudo-file-system.   The  file ID has the following format.
  115.      The server can define the file ID  to  fit  its  own  needs.
  116.      However,  the  special type value of -1 is reserved to indi-
  117.      cate an invalid file ID.
  118.  
  119.           typedef struct {
  120.               int type;
  121.               int serverID;
  122.               int major;
  123.               int minor;
  124.           } Fs_FileID;
  125.  
  126.      The _p_f_s_S_e_r_v_i_c_e procedures are  described  in  detail  below.
  127.      The  _c_l_i_e_n_t_D_a_t_a argument is passed to all the naming service
  128.  
  129.  
  130.  
  131. Sprite v.1.0       Printed:  November 12, 1990                  2
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138. Pfs                   C Library Procedures                    Pfs
  139.  
  140.  
  141.  
  142.      procedures.  It is ordinarily used to get to  the  state  of
  143.      the pseudo-file-system.
  144.  
  145.      The return value of PPffss__OOppeenn is  a  token  for  the  pseudo-
  146.      file-system,    which    must    be   used   in   calls   to
  147.      PPffss__OOppeennCCoonnnneeccttiioonn,   PPffss__PPaassssFFiillee,   PPffss__SSeettHHaannddlleerr,    and
  148.      PPffss__CClloossee.  If a pseudo-file-system couldn't be opened, then
  149.      NULL is returned and ppffss__EErrrroorrMMssgg contains a string describ-
  150.      ing the problem.
  151.  
  152.      The Pfs package uses the facilities of FFss__DDiissppaattcchh in  order
  153.      to  keep  track  of  the streams associated with the pseudo-
  154.      file-system and ensure that Pfs is notified  whenever  those
  155.      streams become readable.  In order to use Pfs, you must also
  156.      use FFss__DDiissppaattcchh.
  157.  
  158. PPffss__OOppeennCCoonnnneeccttiioonn
  159.      PPffss__OOppeennCCoonnnneeccttiioonn is used to create open  file  connections
  160.      to  the pseudo-file-system indicated by _p_f_s_T_o_k_e_n.  Open file
  161.      connections can only be made during an ooppeenn call-back.   The
  162.      open  file  connection  is  the  same  as  a connection to a
  163.      pseudo-device with the addition of two new requests to  han-
  164.      dle  ffssttaatt,  ffcchhmmoodd,  and  ffcchhoowwnn.  The details of using the
  165.      pseudo-device call-backs are given in the PPddeevv man page.
  166.  
  167.      The _f_i_l_e_I_D_P_t_r is a server-defined identifier  for  the  open
  168.      file.   The  server can set the file ID fields to any values
  169.      that make sense to it.  However, by convention a type of  -1
  170.      indicates  an  invalid  fileID.  This special case may occur
  171.      when handling the rreennaammee and hhaarrddLLiinnkk call-backs.  Note that
  172.      the  file  IDs for directories in the pseudo-file-system may
  173.      be presented back to the server as a pprreeffiixxIIDD that indicates
  174.      the  starting point of the lookup operation.  Thus a process
  175.      can have a current directory inside  the  pseudo-file-system
  176.      and name files relative to that directory.
  177.  
  178.      The _p_d_e_v_S_e_r_v_i_c_e parameter is a set  of  pseudo-device  call-
  179.      backs.   The  use of these call-backs is described in detail
  180.      in the PPddeevv man page.
  181.  
  182.      The _r_e_q_B_u_f_S_i_z_e parameter indicates the preferred size of the
  183.      request buffer associated with the pseudo-device connection.
  184.      This size determines how  many  requests  can  be  bufferred
  185.      before the kernel has to wait on the server.  A minimum size
  186.      is enforced by the library, so zero can be passed to get the
  187.      default size (about 1 Kbyte).
  188.  
  189.      The _r_e_a_d_B_u_f_S_i_z_e and _r_e_a_d_B_u_f parameters indicate the size and
  190.      location  of an optional read buffer.  No buffering is indi-
  191.      cated by a zero read buffer size.  See the library PPddeevv  and
  192.      device  ppddeevv  man  pages  for  more  details on using a read
  193.      buffer.
  194.  
  195.  
  196.  
  197. Sprite v.1.0       Printed:  November 12, 1990                  3
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204. Pfs                   C Library Procedures                    Pfs
  205.  
  206.  
  207.  
  208. PPffss__PPaassssFFiillee
  209.      PPffss__PPaassssFFiillee is used to pass the open file descriptor  of  a
  210.      regular  file  back  to  a  client  in  response  to an open
  211.      request.  If this is done then the pseudo-file-system server
  212.      sees  no  further  requests  concerning this open file;  the
  213.      file is handled in the regular way the by kernel.
  214.  
  215.      PPffss__PPaassssFFiillee exists, but the kernel doesn't support it, yet.
  216.  
  217. PPffss__CClloossee
  218.      PPffss__CClloossee is used to end pseudo-file-system  service.   This
  219.      closes  the  naming  stream  to  the kernel and frees up any
  220.      dynamically allocated storage.   After  this  call  _p_f_s_T_o_k_e_n
  221.      should not be used.
  222.  
  223.      PPffss__PPaassssFFiillee exists, but the kernel doesn't support it, yet.
  224.  
  225. NNAAMMEE SSEERRVVIICCEE PPRROOCCEEDDUURREESS
  226.      The callbacks are given to PPffss__OOppeenn  as  a  record  of  pro-
  227.      cedures:
  228.  
  229.           typedef struct {
  230.               int (*open)();  /* PFS_OPEN */
  231.               int (*getAttr)();/* PFS_GET_ATTR */
  232.               int (*setAttr)();/* PFS_SET_ATTR */
  233.               int (*makeDevice)();/* PFS_MAKE_DEVICE */
  234.               int (*makeDir)();/* PFS_MAKE_DIR */
  235.               int (*remove)();/* PFS_REMOVE */
  236.               int (*removeDir)();/* PFS_REMOVE_DIR */
  237.               int (*rename)();/* PFS_RENAME */
  238.               int (*hardLink)();/* PFS_HARD_LINK */
  239.               int (*symLink)();/* PFS_SYM_LINK */
  240.           } Pfs_CallBacks;
  241.  
  242.      Any of the elements can be NULL to indicate that the  opera-
  243.      tion  should be handled by a default handler that is a no-op
  244.      procedure that returns a file-not-found error.  The  _s_e_r_v_i_c_e
  245.      parameter  to  PPffss__OOppeenn  itself can also be NULL to indicate
  246.      default handling for all operations.  This  is  only  useful
  247.      during  initial  test.  The global variable ppffss__TTrraaccee can be
  248.      set to a non-zero value to generate printfs to  stderr  when
  249.      each   service   procedure  (default  or  user-supplied)  is
  250.      invoked.
  251.  
  252.      All the name  service  procedures  have  a  similar  calling
  253.      sequence  that  includes  a relative pathname, a record con-
  254.      taining input parameters, and a buffer for _p_a_t_h_n_a_m_e _r_e_d_i_r_e_c_-
  255.      _t_i_o_n.  (The rreennaammee and hhaarrddlliinnkk procedures have slighly dif-
  256.      ferent calling sequences because they handle two pathnames.)
  257.      The pathname is relative to a prefix indicated by a _p_r_e_f_i_x_I_D
  258.      in the input parameters.  This ID is either for the root  as
  259.      defined  by  the _r_o_o_t_I_D_P_t_r argument to PPffss__OOppeenn, or for some
  260.  
  261.  
  262.  
  263. Sprite v.1.0       Printed:  November 12, 1990                  4
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270. Pfs                   C Library Procedures                    Pfs
  271.  
  272.  
  273.  
  274.      directory who's ID was defined  by  PPffss__OOppeennCCoonnnneeccttiioonn  when
  275.      the directory was entered by a client process.
  276.  
  277.      The service procedures should return 0 to mean success, oth-
  278.      erwise they should return a suitable errno value.  There are
  279.      no other return results.  Open file connections are  created
  280.      as a side effect using PPffss__OOppeennCCoonnnneeccttiioonn.
  281.  
  282.      It is possible that the pathname may leave the  pseudo-file-
  283.      system  during  any  lookup  operation.   This  happens with
  284.      remote links, symbolic links  back  to  the  root,  or  with
  285.      enough ``..'' components to take the pathname out the top of
  286.      the pseudo-file-system.  In this case the pseudo-file-system
  287.      server should return the remaining, or new, pathname instead
  288.      of attempting to follow it itself.  The return code  EERREEMMOOTTEE
  289.      is  used  to  indicate  this  situation, and the _r_e_d_i_r_e_c_t_P_t_r
  290.      argument is used to return the new name:
  291.  
  292.           typedef struct FsRedirectInfo {
  293.               int             prefixLength;
  294.               char fileName[FS_MAX_PATH_NAME_LENGTH];
  295.           } FsRedirectInfo;
  296.  
  297.      If the lookup hits a symbolic link to the  root  the  server
  298.      should  expand the link and return the new absolute pathname
  299.      in this buffer.  A remote link  is  like  a  symbolic  link,
  300.      except it indicates a nested prefix and its contents are the
  301.      prefix itself.  Expanding it will result in a  new  absolute
  302.      pathname.   The length of the prefix that is embedded in the
  303.      absolute path should be returned in the pprreeffiixxLLeennggtthh  field.
  304.      With  regular  symbolic links this field should be zero.  If
  305.      the server hits a ``..'' component that leaves its  root  it
  306.      should place the remaining pathname, including the offending
  307.      ``..'' component, into the buffer.   The  prefix  length  is
  308.      again zero in this case.
  309.  
  310. ooppeenn
  311.           int
  312.           (*service->open)(clientData, name, openArgsPtr, redirectPtr)
  313.               ClientData clientData;/* Passed into Pfs_Open */
  314.               char *name;          /* Relative pathname */
  315.               Fs_OpenArgs *openArgsPtr;/* Identifies prefix and caller */
  316.               FsRedirectInfo *redirectPtr;/* Return - new pathname and prefix info if
  317.                                    * name leaves the pseudo-file-system */
  318.  
  319.      The open service procedure is invoked in response to an ooppeenn
  320.      system call by a client process.  The _c_l_i_e_n_t_D_a_t_a argument is
  321.      the value passed into PPffss__OOppeenn and is generally used to  get
  322.      back to the state kept for the pseudo-file-system.  The _n_a_m_e
  323.      is a relative pathname that begins at the  prefix  indicated
  324.      by  *_o_p_e_n_A_r_g_s_P_t_r.   The  FFssOOppeennAArrggss structure identifies the
  325.      root of  the  pseudo-file-system,  the  prefix  or  starting
  326.  
  327.  
  328.  
  329. Sprite v.1.0       Printed:  November 12, 1990                  5
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336. Pfs                   C Library Procedures                    Pfs
  337.  
  338.  
  339.  
  340.      directory  of  the pathname, and the identity of the calling
  341.      process:
  342.  
  343.           typedef struct {
  344.               Fs_FileID prefixID;  /* File ID from prefix handle */
  345.               Fs_FileID rootID;    /* File ID of root. */
  346.               int useFlags;        /* Flags defined in fs.h */
  347.               int permissions;     /* Permission bits for created files.  Already
  348.                                     * reflects per-process permission mask */
  349.               int type;            /* Used to contrain open to a specific type */
  350.               int clientID;        /* Host ID of client doing the open */
  351.               Fs_UserIDs id;       /* User and group IDs */
  352.           } FsOpenArgs;
  353.  
  354.      The pprreeffiixxIIDD is  either  the  fileID  of  the  root  of  the
  355.      pseudo-file-system,  or  the fileID of some directory in the
  356.      pseudo-file-system that has  been  previously  opened.   The
  357.      uusseeFFllaaggss  is  an or'd combination of flags defined in <fs.h>
  358.      that include FFSS__RREEAADD, FFSS__WWRRIITTEE, and FFSS__EEXXEECCUUTTEE.  The ppeerrmmiiss--
  359.      ssiioonnss define the file mode when creating a file.  File crea-
  360.      tion is indicated by the FFSS__CCRREEAATTEE usage flag.
  361.  
  362.      The ttyyppee is used to constrain the open to a particular  kind
  363.      of  file.  Possible values are FFSS__FFIILLEE, which means any type
  364.      will do, FFSS__DDIIRREECCTTOORRYY when changing the  current  directory,
  365.      and FFSS__SSYYMMBBOOLLIICC__LLIINNKK when reading links.
  366.  
  367.      IMPORTANT:  PPffss__OOppeennCCoonnnneeccttiioonn and PPffss__PPaassssFFiillee can only  be
  368.      called during the servicing of an open request.  If they are
  369.      called (successfully) by the open call-back it  must  return
  370.      0, never a non-zero error status.
  371.  
  372. ggeettAAttttrr
  373.           int
  374.           (*service->getAttr)(clientData, name, openArgsPtr, attrPtr, redirectInfoPtr)
  375.               ClientData clientData;/* Passed into Pfs_Open */
  376.               char *name;          /* Relative pathname */
  377.               FsOpenArgs *openArgsPtr;/* Bundled arguments */
  378.               Fs_Attributes *attrPtr;/* Return - attributes of the file */
  379.               FsRedirectInfo *redirectInfoPtr;/* Used when name leaves our domain */
  380.  
  381.      This call-back is made to get the attributes of  a  file  in
  382.      the  pseudo-file-system  given  its pathname.  The arguments
  383.      are similar to those of the  ooppeenn  call-back.   The  _a_t_t_r_P_t_r
  384.      argument is used to return the attributes.
  385.  
  386. sseettAAttttrr
  387.           int
  388.           (*service->setAttr)(clientData, name, openArgsPtr, flags, attrPtr,
  389.                redirectInfoPtr)
  390.               ClientData clientData;/* Passed into Pfs_Open */
  391.               char *name;          /* Relative pathname */
  392.  
  393.  
  394.  
  395. Sprite v.1.0       Printed:  November 12, 1990                  6
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402. Pfs                   C Library Procedures                    Pfs
  403.  
  404.  
  405.  
  406.               FsOpenArgs *openArgsPtr;/* Bundled arguments */
  407.               int flags;           /* Specifies which attrs to set */
  408.               Fs_Attributes *attrPtr;/* New attributes of the file */
  409.               FsRedirectInfo *redirectInfoPtr;/* Used when name leaves our domain */
  410.  
  411.      This call-back is made to set certain attributes of  a  file
  412.      in the pseudo-file-system given its pathname.  The arguments
  413.      are similar to those of the ooppeenn  call-back.   Additionally,
  414.      the _f_l_a_g_s argument indicates which attributes are to be set,
  415.      and the _a_t_t_r_P_t_r argument specifies their  new  values.   The
  416.      _f_l_a_g_s  are an or'd combination of FFSS__SSEETT__TTIIMMEESS, FFSS__SSEETT__MMOODDEE,
  417.      FFSS__SSEETT__OOWWNNEERR, FFSS__SSEETT__FFIILLEE__TTYYPPEE, FFSS__SSEETT__DDEEVVIICCEE.
  418.  
  419. mmaakkeeDDeevviiccee
  420.           int
  421.           (*service->makeDevice)(clientData, name, makeDevArgsPtr, redirectInfoPtr)
  422.               ClientData clientData;/* Passed into Pfs_Open */
  423.               char *name;          /* Relative pathname */
  424.               FsMakeDeviceArgs *makeDevArgsPtr;/* Bundled arguments */
  425.               FsRedirectInfo *redirectInfoPtr;/* Used when name leaves our domain */
  426.  
  427.      This call-back is made to create a special  device  file  in
  428.      the pseudo-file-system.  The FFssMMaakkeeDDeevviicceeAArrggss are similar to
  429.      the FFssOOppeennAArrggss with some addition information about the dev-
  430.      ice:
  431.  
  432.           typedef struct {
  433.               Fs_FileID prefixID;  /* FileID of the prefix */
  434.               Fs_FileID rootID;    /* FileID of the root */
  435.               Fs_Device device;    /* Device attributes */
  436.               int permissions;     /* Permissions already reflect per-process mask */
  437.               Fs_UserIDs id;       /* Identifies calling process */
  438.               int clientID;        /* Identifies host of calling process */
  439.           } FsMakeDeviceArgs;
  440.  
  441. mmaakkeeDDiirr
  442.           int
  443.           (*service->makeDir)(clientData, name, openArgsPtr, redirectInfoPtr)
  444.               ClientData clientData;/* Passed into Pfs_Open */
  445.               char *name;          /* Relative pathname */
  446.               FsOpenArgs *openArgsPtr;/* Bundled arguments */
  447.               FsRedirectInfo *redirectInfoPtr;/* Used when name leaves our domain */
  448.  
  449.      This call-back is made to create a directory.  The arguments
  450.      are similar to those of the ooppeenn call-back.
  451.  
  452. rreemmoovvee
  453.           int
  454.           (*service->remove)(clientData, name, lookupArgsPtr, redirectInfoPtr)
  455.               ClientData clientData;/* Passed into Pfs_Open */
  456.               char *name;          /* Relative pathname */
  457.               FsLookupArgs *lookupArgsPtr;/* Bundled arguments */
  458.  
  459.  
  460.  
  461. Sprite v.1.0       Printed:  November 12, 1990                  7
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  
  468. Pfs                   C Library Procedures                    Pfs
  469.  
  470.  
  471.  
  472.               FsRedirectInfo *redirectInfoPtr;/* Used when name leaves our domain */
  473.  
  474.      This call-back is made to remove a file in the  pseudo-file-
  475.      system.   FFssLLooookkuuppAArrggss  are  a  simplified  sub-set  of FFssOO--
  476.      ppeennAArrggss:
  477.  
  478.           typedef struct {
  479.               Fs_FileID prefixID;  /* FileID of the prefix */
  480.               Fs_FileID rootID;    /* FileID of the root */
  481.               int useFlags;        /* not used */
  482.               Fs_UserIDs id;       /* User and group IDs of calling process */
  483.               int clientID;        /* Host ID of calling process */
  484.           } FsLookupArgs;
  485.  
  486. rreemmoovveeDDiirr
  487.           int
  488.           (*service->removeDir)(clientData, name, lookupArgsPtr, redirectInfoPtr)
  489.               ClientData clientData;/* Passed into Pfs_Open */
  490.               char *name;          /* Relative pathname */
  491.               FsLookupArgs *lookupArgsPtr;/* Bundled arguments */
  492.               FsRedirectInfo *redirectInfoPtr;/* Used when name leaves our domain */
  493.  
  494.      This call-back is made to remove a directory in the  pseudo-
  495.      file-system.   The server should check against removing non-
  496.      empty directories.   The  arguments  are  the  same  as  for
  497.      rreemmoovvee.
  498.  
  499. rreennaammee
  500.           int
  501.           (*service->rename)(clientData, srcName, dstName, twoNameArgsPtr,
  502.                redirect2InfoPtr)
  503.               ClientData clientData;    /* Passed into Pfs_Open */
  504.               char *srcName;            /* Original name */
  505.               char *dstName;            /* New name */
  506.               Fs2PathParams *twoNameArgsPtr;/* Lookup args plus prefixID2 */
  507.               Fs2PathRedirectInfo *redirect2InfoPtr;/* Used when name leaves our domain */
  508.  
  509.      This call-back is made to change the name of a file  in  the
  510.      pseudo-file-system.   The  arguments  are  bundled  into the
  511.      FFss22PPaatthhPPaarraammss structure:
  512.  
  513.           typedef struct Fs2PathParams {
  514.               FsLookupArgs lookup;      /* Regular lookup parameters */
  515.               Fs_FileID prefixID2;      /* Prefix of second pathname */
  516.           } Fs2PathParams;
  517.  
  518.      It is possible that the second pathname is not a part of the
  519.      pseudo-file-system.   The  Sprite  kernel still calls out to
  520.      the pseudo-file-system in this case because the first  path-
  521.      name  might be redirected out of the pseudo-file-system.  If
  522.      the second prefixID does  not  belong  to  the  pseudo-file-
  523.      system  that  is  indicated  by  a ttyyppee value of -1.  If the
  524.  
  525.  
  526.  
  527. Sprite v.1.0       Printed:  November 12, 1990                  8
  528.  
  529.  
  530.  
  531.  
  532.  
  533.  
  534. Pfs                   C Library Procedures                    Pfs
  535.  
  536.  
  537.  
  538.      first pathname remains in  the  pseudo-file-system  but  the
  539.      second  prefixID  is  not in the pseudo-file-system then the
  540.      error EEXXDDEEVV should be returned.  If either of the  pathnames
  541.      gets   redirected,   or  an  error  occurs  during  pathname
  542.      interpretation, the FFss22PPaatthhRReeddiirreeccttIInnffoo structure is used to
  543.      return more information:
  544.  
  545.           typedef struct {
  546.               int name1ErrorP;/* TRUE if redirection or other error applies
  547.                                * to the first pathname, FALSE if the error
  548.                                * applies to second pathname, or no error */
  549.               int prefixLength;/* The length of the prefix embedded in
  550.                                * fileName.  This is used when a server hits
  551.                                * a remote link and has to return a new file
  552.                                * name plus an indication of a new prefix. */
  553.               char fileName[FS_MAX_PATH_NAME_LENGTH];
  554.                               /* The new file name.  Returned
  555.                                * from the server when its lookup is about
  556.                                * to leave its domain. */
  557.           } Fs2PathRedirectInfo;
  558.  
  559. hhaarrddLLiinnkk
  560.           int
  561.           (*service->hardLink)(clientData, srcName, dstName, twoNameArgsPtr,
  562.                redirect2InfoPtr)
  563.               ClientData clientData;    /* Passed into Pfs_Open */
  564.               char *srcName;            /* Original name */
  565.               char *dstName;            /* New name */
  566.               Fs2PathParams *twoNameArgsPtr;/* Lookup args plus prefixID2 */
  567.               Fs2PathRedirectInfo *redirect2InfoPtr;/* Used when name leaves our domain */
  568.  
  569.      This call-back is used to create a  hard  link  between  two
  570.      files in the pseudo-file-system.  The arguments are the same
  571.      as those for rreennaammee, and the same  comments  about  pathname
  572.      redirection apply.
  573.  
  574. ssyymmLLiinnkk
  575.           int
  576.           (*service->symLink)(clientData, linkName, value, openArgsPtr, redirectInfoPtr)
  577.               ClientData clientData;    /* returned from Pfs_Open */
  578.               char *linkName;           /* SymLink file name */
  579.               char *value;              /* Symlink value */
  580.               FsOpenArgs *openArgsPtr;  /* Open arguments */
  581.               FsRedirectInfo *redirectInfoPtr;/* Used when srcName leaves our domain */
  582.  
  583.      This call-back is used to create  a  symbolic  link  in  the
  584.      pseudo-file-system.   The arguments are similar to those for
  585.      ooppeenn, except there are two pathnames.  Pathname  redirection
  586.      is  only  possible  on  the _l_i_n_k_N_a_m_e.  The _v_a_l_u_e pathname is
  587.      simply used as the value of the link regardless of its loca-
  588.      tion  in the system.  (This is not currently used.  Symbolic
  589.      links  are  created  instead  by  opening  a  file  of  type
  590.  
  591.  
  592.  
  593. Sprite v.1.0       Printed:  November 12, 1990                  9
  594.  
  595.  
  596.  
  597.  
  598.  
  599.  
  600. Pfs                   C Library Procedures                    Pfs
  601.  
  602.  
  603.  
  604.      FS_SYMBOLIC_LINK  and  writing the link value into it.  This
  605.      will change, although it currently works in NFS.)
  606.  
  607.      The ttyyppee field  in  the  open  args  is  used  differentiate
  608.      between a regular symbolic link and a remote link.  A remote
  609.      link is a circular  symbolic  link  with  a  different  file
  610.      descriptor type than a symbolic link.  Remote links are used
  611.      in native Sprite file systems to indicate  a  nested  prefix
  612.      that is stored elsewhere.  Bumping into a remote link causes
  613.      a pathname redirection just like  hitting  a  symbolic  link
  614.      back  to  the  root.  Additionally, however, the redirection
  615.      information also includes the length of the prefix  that  is
  616.      embedded into the returned pathname.
  617.  
  618. SSEEEE AALLSSOO
  619.      pfs (devices), Pdev, Swap_Buffer
  620.  
  621. KKEEYYWWOORRDDSS
  622.      pseudo-file-system
  623.  
  624.  
  625.  
  626.  
  627.  
  628.  
  629.  
  630.  
  631.  
  632.  
  633.  
  634.  
  635.  
  636.  
  637.  
  638.  
  639.  
  640.  
  641.  
  642.  
  643.  
  644.  
  645.  
  646.  
  647.  
  648.  
  649.  
  650.  
  651.  
  652.  
  653.  
  654.  
  655.  
  656.  
  657.  
  658.  
  659. Sprite v.1.0       Printed:  November 12, 1990                 10
  660.  
  661.  
  662.  
  663.